<script>

import axios from "axios";


export default {

  data() {
    return {
      dialogImportExcelVisible: false,
      //缩略图的回显
      idArr: [],
      mode: {
        title: "",
        url: "",
      },
      hobbyArr: [],
      form: {
        because: "",
      },
      rules: {
        because: [
          { required: true, message: '请输入原因', trigger: 'blur' },
        ],
      },
      imageUrl: "",
      formLabelWidth: "200px",
      dialogFormVisible: false,//为true弹窗弹起,为false弹窗隐藏    修改 添加弹窗
      page: {},//员工列表
      deptList: [],// 部门列表
      searchParam: {},//搜索条件
      size: 2,//每页最大展示条件
      current: 1,//默认当前页为第一页
      dialogInfoVisible:false,   //暂时没有用到
      dialogSpVisible:false,     //没有用到
      dialogXqVisible:false,     //详情
      dialogShenqVisible:false,  //没有用到 （审批）
      dialogSstatusVisible:false,//审核通过编程待服务
      dialogSoverruleVisible:false,// 驳回原因弹窗修改

      count:0,
    }
  },
  methods: {



    //选中
    handleSelectionChange(val) {
      this.idArr = [];//清空
      for (let i = 0; i < val.length; i++) {
        this.idArr.push(val[i].id);
      }
    },
    //完成服务

    searchData() {
      this.current = 1;
      //再查
      this.initData();
    },
    handleCurrentChange(val) {
      this.current = val;
      //再查
      this.initData();
    },
    //当每页最大展示条数发生改变的时候
    handleSizeChange(val) {
      this.size = val;
      //再查
      this.initData();
    },
    toRes() {
      this.searchParam = {};
    },
    initData() {
      axios.post(`http://localhost:8088/Log/findAll?current=${this.current}&size=${this.size}`, this.searchParam).then(res => {
        //this.属性名表示全局变量
        this.page = res.data;
      });
    },


    // initDeptList(){
    //   axios.post("http://localhost:9001/Labe/findAll").then(res=>{
    //     //this.属性名表示全局变量
    //     this.deptList=res.data;
    //   })
    // }

  },
  created() {
    this.initData();
    this.initDeptList();
  },
  filters:{
    format(value,arg){
      function dateFormat(date, format) {
        if (typeof date === "string") {
          var mts = date.match(/(\/Date\((\d+)\)\/)/);
          if (mts && mts.length >= 3) {
            date = parseInt(mts[2]);
          }
        }
        date = new Date(date);
        if (!date || date.toUTCString() == "Invalid Date") {
          return "";
        }
        var map = {
          "M": date.getMonth() + 1, //月份
          "d": date.getDate(), //日
          "h": date.getHours(), //小时
          "m": date.getMinutes(), //分
          "s": date.getSeconds(), //秒
          "q": Math.floor((date.getMonth() + 3) / 3), //季度
          "S": date.getMilliseconds() //毫秒
        };
        format = format.replace(/([yMdhmsqS])+/g, function (all, t) {
          var v = map[t];
          if (v !== undefined) {
            if (all.length > 1) {
              v = '0' + v;
              v = v.substr(v.length - 2);
            }
            return v;
          } else if (t === 'y') {
            return (date.getFullYear() + '').substr(4 - all.length);
          }
          return all;
        });
        return format;
      }
      return dateFormat(value,arg);
    }
  },

}
</script>

<template>

  <div>
    总申请数：{{page.total}}
    <br>
    名称：<el-input v-model="searchParam.logname" placeholder="请输入姓名" style="width: 200px"></el-input>

<!--    服务状态：<el-select v-model="searchParam.logname" placeholder="请选择" style="width: 200px">-->
<!--    <el-option value="李明明" label="李明明">李明明</el-option>-->
<!--    <el-option value="李敏进" label="李敏进">李敏进</el-option>-->
<!--    <el-option value="王海文" label="王海文">王海文</el-option>-->
<!--  </el-select>-->
    <el-button type="primary" @click="searchData">搜索</el-button>
    <el-button type="primary" @click="toRes">重置</el-button>

    <el-table
        :data="page.records"
        border
        style="width: 100%"
        @selection-change="handleSelectionChange">
      <el-table-column
          type="selection"
          width="55">
      </el-table-column>
      <el-table-column
          prop="logname"
          label="操作人">
      </el-table-column>
      <el-table-column
          prop="logjoindate"
          label="申请时间">
        <template slot-scope="scope">
          {{scope.row.logjoindate | format('yyyy-MM-dd')}}
        </template>
      </el-table-column>
      <el-table-column
          prop="logip"
          label="Ip">
      </el-table-column>
      <el-table-column
          prop="logmodel"
          label="操作模块">
      </el-table-column>
      <el-table-column
          prop="logoperate"
          label="操作医生">
      </el-table-column>
    </el-table>

    <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page.current"
        :page-sizes="[2, 200, 300, 400]"
        :page-size="page.size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.total">
    </el-pagination>
  </div>
</template>

<style scoped>


</style>
